using System;
using Microsoft.Xna.Framework;
using WindowsGame.Common.Library;
using WindowsGame.Common.Static;

namespace WindowsGame.Common.Managers
{
	public interface IBoardManager
	{
		void LoadContent();
		void LoadContent(BoardType boardType, Int32 wide, Int32 high);
		void Draw();
	}

	public class BoardManager : IBoardManager
	{
		private Int32 wide, high, step;
		private Color color;

		public void LoadContent()
		{
			BoardType boardType = MyGame.Manager.ConfigManager.BoardType;
			LoadContent(boardType, Constants.SCREEN_WIDE, Constants.SCREEN_HIGH);
			color = Color.LightSlateGray;
		}
		public void LoadContent(BoardType boardType, Int32 theWide, Int32 theHigh)
		{
			wide = theWide;
			high = theHigh;
			step = (Int32)boardType * 8;
		}

		public void Draw()
		{
			for (int x = 0; x < wide; x += step)
			{
				Engine.SpriteBatch.Draw(Assets.VerticalTexture, new Vector2(x, 0), color);
			}
			for (int y = 0; y < high; y += step)
			{
				Engine.SpriteBatch.Draw(Assets.HorizontalTexture, new Vector2(0, y), color);
			}

			Engine.SpriteBatch.Draw(Assets.VerticalTexture, new Vector2(wide - 1, 0), color);
			Engine.SpriteBatch.Draw(Assets.HorizontalTexture, new Vector2(0, high - 1), color);
		}

	}
}